using System;
using Core.Utils;
using Game.Trade;
using UnityEngine;
using UnityEngine.EventSystems;

public class TradeItem : MonoBehaviour , IResetable, IPointerClickHandler {
    public Action<ISellable> OnTradeItemClick;
    public ISellable Data {
        get;
        private set;
    }
    
    public void Init(ISellable data,Action<ISellable> onTradeItemClick) {
        Data = data;
        OnTradeItemClick = onTradeItemClick;
    }

    public void OnPointerClick(PointerEventData eventData) {
        OnTradeItemClick?.Invoke(Data);
    }
    
    public void Reset() {
        Data = null;
    }
}
